package com.boxs;

import java.util.Scanner;

public class Guss {
    private int v;
    private int num;

    public int getV() {
        return v;
    }

    public int getNum() {
        return num;
    }

    public void setV(int v) {
        this.v = v;
    }

    public void setNum(int num) {
        this.num = num;
    }

    @Override
    public String toString() {
        return "Guss{" +
                "v=" + v +
                ", num=" + num +
                '}';
    }

    public static int  game(int nums){
        int a = 100;
        if (nums <a){
            System.out.println("猜的有点小了");
            System.out.println(nums);
        }else if(nums > a){
            System.out.println("猜的有点大了");
            System.out.println(nums);
        }else{
            System.out.println("猜对了");
            System.out.println(nums);
            return 1;
        }
        return -1;
    }

    public static void main(String[] args) {
        while (true){
            Scanner sc = new Scanner(System.in);
            System.out.println("输入一个数字：");
            String s = sc.nextLine();

            try {
                int i = Integer.parseInt(s);
                if (game(i) == 1) {
                    break;
                }
            }catch (NumberFormatException e){
                System.out.println("请输入整数："+e);
            }
        }
    }
}
